from config import BASE_URL, PHONE
from page.page_register import RegisterPage
from script import log
from tools import DriverTools

phone = PHONE
class TestRegister(object):
    def setup_method(self):
        driver = DriverTools.get_driver()
        driver.get(BASE_URL+"/common/member/reg")
        self.reg = RegisterPage(driver)

    def teardown_method(self):
        # 关闭浏览器
        DriverTools.quit_driver()

    def test01_reg_success(self):
        self.reg.register(phone, "abc123", "8888")
        print(self.reg.get_success_result())
        log.info(f"执行结果：{self.reg.get_success_result()}")
        assert "注册成功" in self.reg.get_success_result()
        self.reg.get_shot("pwd_success.png")

    def test02_reg_error(self):
        self.reg.register("18683060061", "abc123", "8888")
        print(self.reg.get_error_result())
        log.info(f"执行结果：{self.reg.get_success_result()}")
        assert "注册抢88现金" in self.reg.get_error_result()
        self.reg.get_shot("pwd_error1.png")

    def test03_reg_error(self):
        self.reg.register("18683060064", "123456", "8888")
        print(self.reg.get_error_result())
        log.info(f"执行结果：{self.reg.get_success_result()}")
        assert "注册抢88现金" in self.reg.get_error_result()
        self.reg.get_shot("pwd_error2.png")
